<%-- 
    Document   : personlist
    Created on : Apr 17, 2010, 6:14:16 PM
    Author     : Caesar
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<f:view locale="#{locale.locale}">
    <f:loadBundle basename="ru.ssau.berlin.jsf.i18n.Messages" var="bundle"/>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title><h:outputText value="#{bundle.ssau_manage_system} :: #{bundle.persons}"/></title>
        </head>
        <body>
            <small>
                <h:form>
                    <h:commandLink action="#{locale.setLocale}" value="en">
                        <f:param name="locale" value="en"/>
                    </h:commandLink> |
                    <h:commandLink action="#{locale.setLocale}" value="ru">
                        <f:param name="locale" value="ru"/>
                    </h:commandLink>
                </h:form>
            </small>
            <h1><h:outputText value="#{bundle.persons}"/></h1>
            <h:form>
                <h:dataTable value="#{person.persons}" var="item" border="1">
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.id}"/>
                        </f:facet>
                        <h:outputText value="#{item.id}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.name}"/>
                        </f:facet>
                        <h:outputText value="#{item.name}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.type}"/>
                        </f:facet>
                        <h:outputText value="#{item.type.name}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.actions}"/>
                        </f:facet>
                        <h:commandLink action="#{person.showPerson}" value="#{bundle.show}">
                            <f:param name="id_param" value="#{item.id}"/>
                        </h:commandLink> |
                        <h:commandLink action="#{person.editPerson}" value="#{bundle.edit}">
                            <f:param name="id_param" value="#{item.id}"/>
                        </h:commandLink> |
                        <h:commandLink actionListener="#{person.deletePerson}"
                                       value="#{bundle.delete}" action="#{person.showAllPersons}">
                            <f:attribute name="id_param" value="#{item.id}"/>
                        </h:commandLink>
                    </h:column>
                </h:dataTable>
            </h:form>
            <h:form>
                <h:commandLink action="#{person.newPerson}" value="#{bundle.new_person}"/> <br />
                <h:commandLink action="#{navigator.goToMainPage}" value="#{bundle.home}"/>
            </h:form>
        </body>
    </html>
</f:view>
